package com.rao.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

/**
 * <p>
 *
 * </p>
 *
 * @author rao3030
 * @since 2021-11-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@NoArgsConstructor
@TableName("tb_user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "user_id", type = IdType.AUTO)
    private Long userId;

    /**
     * 账号
     */
    @NotBlank(message = "用户名不允许为空")
    @Length(max = 10, min = 4, message = "用户名长度必须在4-20字符之间")
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不允许为空")
    @Length(max = 10, min = 4, message = "密码长度必须在8-20字符之间")
    private String password;

    /**
     * 电话
     */
    private String telephone;

    /**
     * 逻辑删除【0:代表删除，1:没有被删除】
     */
    private Boolean deleted;


    public User(String username, String password) {
        this.username=username;
        this.password=password;
    }
}
